<?php
class Traloi extends Zend_Db_Table_Abstract{
    protected $_name;
    protected $_primary = 'traloi_id';

    function __construct() {
        $this->_name = DB_PREFIX . "traloi";
        parent::__construct(); 
    }    
    public function getPrimaryKey() {
        $pk = $this->_primary;
        if (is_array($pk)) {
            if (count($pk) > 0)
                return $pk[1]; // array[1] contain column name of primary key
        }
        return $this->_primary;
    }
    public function getResultByUserId($where = null, $order = "traloi_id DESC"){
    	$select = Zend_Db_Table_Abstract::select();
    	$select->setIntegrityCheck(false);
    	if($where != null){
    		$select->where($where);
    	}
    	$select->order($order);
    	
    	$data = $this->fetchAll($select);
        return $data;
    }
    public function getRowResultByWhere($where = null){
    	$select = Zend_Db_Table_Abstract::select();
    	$select->setIntegrityCheck(false);
    	if($where != null){
    		$select->where($where);
    	}
    	
    	$data = $this->fetchRow($select);
        return $data;
    }
}
?>
